<template>
  <div class="deposit-manage">
    <el-form label-position="top">
      <el-form-item label="支付宝支付上下限">
          <el-input clearable placeholder="请设置支付下限" v-model="searchForm.aliPay_mini_limit"></el-input>
          <span> - </span>
          <el-input clearable placeholder="请设置支付上限" v-model="searchForm.aliPay_max_limit"></el-input>
      </el-form-item>
      <el-form-item label="快捷支付上下限">
          <el-input clearable placeholder="请设置支付下限" v-model="searchForm.quickPay_mini_limit"></el-input>
          <span> - </span>
          <el-input clearable placeholder="请设置支付上限" v-model="searchForm.quickPay_max_limit"></el-input>
      </el-form-item>
      <el-form-item v-for="(item, n) in itemList" :key="n" :label="item.title">
        <el-radio-group v-model="searchForm[item.key]">
          <el-radio v-for="(subItem, i) in list" :key="i" :label="subItem.value">{{subItem.name}}</el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="save">保存</el-button>
      </el-form-item>
    </el-form>
    <el-dialog title="提示" :visible.sync="dialogVisible" width="30%">
      <span>这是一段信息</span>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>
<script>
import { mapActions } from 'vuex'
export default {
  name: 'Depositmanage',
  data () {
    return {
      dialogVisible: false,
      list: [
        { value: '1', name: '开启' },
        { value: '2', name: '关闭' }
      ],
      itemList: [
        { title: '存款方式配发', key: 'status' },
        { title: '支付宝存款', key: 'aliPay' },
        { title: '快捷支付', key: 'qucikPay' },
        { title: '网关支付', key: 'gateWayPay' }
      ],
      searchForm: {
        status: '',
        aliPay: '',
        qucikPay: '',
        gateWayPay: '',
        aliPay_mini_limit: '',
        aliPay_max_limit: '',
        quickPay_mini_limit: '',
        quickPay_max_limit: ''
      }
    }
  },
  created () {
    this.init()
  },
  methods: {
    ...mapActions({
      getInitData: 'depositManage/getInitData',
      update: 'depositManage/update'
    }),
    init () {
      this.getInitData().then(res => {
        this.searchForm = res[0]
      })
    },
    save () {
      this.update(this.searchForm).then(res => {
        if (res) {
          this.$message.success('保存成功')
        }
      })
    }
  }
}
</script>
